--
-- Author: shunguo.chen
-- Date: 2018-03-09 15:01:35
--
-- ChessSelect 抉择选项

local ChessAction = import(".ChessAction")

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data)
	if data then
		self:init(data)
	end

end

-- //抉择格子详情
-- message StarChessSelectCellInfo{
-- 	STARCHESS_SELECTTYPE type = 1;
-- 	repeated StarChessSelectInfo selectInfos = 3; 
-- }
function ClassRef:init(data)
	self.type = data.type

	local infos = {0,0,0}
	if self.type == "SELECTROLE" then
		for i,v in ipairs(data.selectInfos) do
			local role = app:sendMsg("CosplayModel", "getRoleById", v.selectID)
			infos[i] = {
				beSelected = v.beSelected,
				selectID = v.selectID,
				data = role
			}
		end
	elseif self.type == "SELECTACTION" then
		for i,v in ipairs(data.selectInfos) do
			infos[i] = {
				beSelected = v.beSelected,
				selectID = v.selectID,
				data = ChessAction.new(v.selectID)
			}
		end
	end
	self.infos = infos
end

function ClassRef:isRoleSelect()
	return self.type == "SELECTROLE"
end

return ClassRef